<script language="jscript" runat="server">
asplib.data.page = function(intPage, intPageCount)
{
	this.ArrayPage = new Array();

	var scriptName, query, pageLink;
	
	scriptName = Request.ServerVariables("SCRIPT_NAME");
	query      = new String(Request.ServerVariables("QUERY_STRING"));
	intPage    = new Number(intPage);
		
	//
	var tmp = new Object();
	var start, end;

	if (intPageCount < 10) {
		start = 1;
		end   = intPageCount;
	}
	
	if ((intPage - 2) < 1 && intPageCount >= 10 )
	{
		start = 1;
		end   = 10;
	}
	
	if ((intPage + 7) > intPageCount && intPageCount - 9 > 1) {
		start = intPageCount - 9;
		end   = intPageCount;
	}
	
	if (intPage - 2 >= 1 && intPage + 7 <= intPageCount) {
		start = intPage - 2;
		end   = intPage + 7;
	}

	for (i = start; i <= end; i++) {
		if (query.indexOf("page=") == -1) {
			if (query.length == 0) {
				pageLink = scriptName + "?" + query + "page=" + i;
			} else {
				pageLink = scriptName + "?" + query + "&page=" + i;
			}
		} else {
			pageLink = scriptName + "?" + query.replace(/page=([0-9]+)/g, "page=" + i);
		}
		
		tmp = new Object();
		tmp.number = i;
		tmp.href   = pageLink
		if (tmp.number == intPage) {
			tmp.link = tmp.number;
		} else {
			tmp.link = "<a href=\"" + tmp.href + "\">" + tmp.number + "</a>";
		}
		this.ArrayPage.push(tmp);
		tmp = null;
	}
}
</script>